<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>快速安装 - {:site('site_title')}</title>
    <link rel="stylesheet" href="__STATIC__/bootstrap/css/bootstrap.min.css"/>
    <style>
        .container {
            max-width: 600px;
            margin: 90px auto;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="alert alert-info">
        <ol>
            <li style="color:#c00;">配置数据库于 config/database.php</li>
            <li>复制 backup 下 bak_备份名 一键安装</li>
            <li>重装：清空数据库并删除 backup/install.lock</li>
        </ol>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            一键快速还原安装(迁移)
        </div>
        <div class="panel-body">
            <form class="install form-inline" action="{:url('index/index')}" method="post">
                <div class="form-group">
                    <label for="path">备份名称：</label>
                    <input type="text" class="form-control" id="path" name="path" placeholder="备份文件夹名 bak_***" />
                </div>
                <button type="submit" class="btn btn-primary">一键安装</button>
                <a href="__HOST__" class="btn btn-success">进入前台</a>
                <a href="__HOST__/admin.php" class="btn btn-info">进入后台</a>
            </form>
        </div>
    </div>
</div>

<script src="__STATIC__/js/jquery-3.7.1.min.js"></script>
<script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>
<script src="__STATIC__/layer_mobile/layer.js"></script>
<script src="__STATIC__/js/aphp-1.1.js?v={:site_ver()}"></script>
<script>
    $(function () {
        $('.install').submit(function(){
            var url = $(this).attr('action');
            var data = $(this).serialize();
            var bak = layer.open({content:'还原安装中，请耐心等待……', shadeClose: false, type: 2});
            $.post(url,data,function(res){
                layer.close(bak);
                if (res.status === 1) {
                    toast(res.msg);
                } else {
                    toast(res.msg);
                }
            },'json');
            return false;
        });
    });
</script>
</body>
</html>